<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>仓库管理系统</title>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/images/favicon.ico" />
    <link href="${pageContext.request.contextPath}/static/login/login.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-easyui-1.3.0/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        //刷新验证码
        function refresh() {
            document.getElementById("randImage").src = '${pageContext.request.contextPath}/admin/enimg?' + Math.random();
        }
        //给body监听keydown事件，实现按回车登录，调用登录方法
        function btnlogin(){
        	if(event.keyCode==13){
        		startSubmit();
        	}
        }
        //提交登录
        function startSubmit() {
            if ($("#cardNo").val() == "") {
                alert("手机号不能为空");
                $("#cardNo").focus();
                return;
            }
            if ($("#cardNo").val().length > 20) {
                alert("手机号长度过长请输入正确手机号");
                return;
            }
            if ($("#password").val() == "") {
                alert("密码不能为空");
                $("#password").focus();
                return;
            }
            if ($("#password").val().length > 20) {
                alert("密码长度过长请输入正确密码");
                return;
            }
            if ($("#smscode").val() == "") {
                alert("验证码不能为空");
                $("#smscode").focus();
                return;
            }
            if ($("#smscode").val().length > 4) {
                alert("验证码长度过长请输入正确验证码");
                return;
            }
            var form = document.getElementById('form1');
            $("#msg").hide();
            form.submit();
        }
    </script>
</head>
<body onkeydown="btnlogin();">
<div class="login_b">
    <div class="header"><!--<div class="header_logo"><img src="images/logo.png" width="140" height="47"></div> -->
        <p class="header_con">仓库管理系统(SpringBoot+MyBatis+SQLServer技术开发，附项目源代码)</p>
    </div>
    <div class="lgn_bx">
        <div class="login_con">
            <div class="lgn_con">
                <div class="login_con_bx">
                    <div class="login_tit">用户登录</div>
                    <div>
                        <ul class="login_con_bx_bl">
                            <c:if test="${msg!=null}">
                                <div id="msg" class="alert alert-error" style="color: red;font-size: 12px;">
                                    <span>${msg}</span>
                                </div>
                            </c:if>
                            <form id="form1" method="post" action="${pageContext.request.contextPath}/admin/logins" target="_top">
                                <li style="cursor: hand">
                                    <span style="cursor: hand"><img
                                            src="${pageContext.request.contextPath}/static/images/login_icon02.png"/></span>
                                    <div class="lgtel">
                                        <input type="text" placeholder="请输入手机号" id="cardNo" name="cardNo"
                                               value="${cardNo}" class="telbt"/>
                                    </div>
                                </li>
                                <li>
                                    <span><img src="${pageContext.request.contextPath}/static/images/login_icon01.png"/></span>
                                    <div class="lgtel">
                                        <input type="password" id="password" name="password" value="${password}"
                                               placeholder="请输入密码" class="telbt"/>
                                    </div>
                                </li>
                                <li style="border:none">
                                    <div class="lgtel" style="width:50%;border:1px solid #B7B7B7;">
                                        <input type="text" name="smscode" id="smscode" placeholder="请输入验证码"
                                               class="telbt" style="width:120px;" title="按回车键登录">
                                    </div>
                                    
                                    <div class="rzm_btn">
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="${pageContext.request.contextPath}/admin/enimg" onclick="refresh();"
                                             width="70" height="42" id="randImage" align="top" alt="点击换一张">
                                    </div>
                                </li>
                                <li style="border:none">
                                    <div class="rzm_btn">
                                        <input type="checkbox" id="rememberPwd" name="rememberPwd" checked="checked">记住用户名
                                    </div>
                                </li>
                                <li style="border:none; background:none">
                                    <a class="login_btn" href="javascript:void(0);" onclick="startSubmit();" title="按回车键登录">登录</a>
                                </li>
                            </form>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    
    <div class="footer">
        <a href="${pageContext.request.contextPath}/app/ChromeSetup.exe" style="text-decoration:none">使用谷歌或者火狐浏览器,在1366*768分辨率及以上版本效果最佳,下载浏览器</a>
    </div>
</div>
</body>
</html>
